class Solution {
public:
    int findMin(vector<int>& nums) {
        int sz=nums.size()-1;
        int l=0;
        int r=sz;
        while(l<r)
        {
            int m=l+(r-l)/2;
            if(nums[m]>nums[sz])
                l=m+1;
            else if(nums[m]<nums[sz])
                r=m;
        }
        return nums[l];
    }
};
